<template>
  <Select v-bind="$attrs">
    <SelectOption v-for="(item, index) in AreaList"
                  :key="index"
                  :value="String(item.id)">{{
      item.city
    }}</SelectOption>
  </Select>
</template>
<script lang="ts">
import { defineComponent, ref, toRefs } from 'vue';
import { Select } from 'ant-design-vue';
import { GetcitylistApi } from '/@/api/activityAdmin/index';
export default defineComponent({
  name: 'AreaSelect',
  components: {
    Select,
    SelectOption: Select.Option,
  },
  props: {
    value: {
      type: String,
      default: 'id',
    },
  },
  setup(props) {
    const { value } = toRefs(props);
    console.log(value);
    let AreaList = ref<any[]>([]);
    function getAreaList() {
      GetcitylistApi().then((res) => {
        if (res.code === 200) {
          AreaList.value = res.data;
        }
      });
    }
    getAreaList();
    return {
      AreaList,
    };
  },
});
</script>
<style lang="less" scoped></style>
